//
// Copyright (c) 2024 BPer
//
#ifndef INCLUDE_BPERUTIL_BPERTYPE_H_
#define INCLUDE_BPERUTIL_BPERTYPE_H_
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <bper_config.h>
#include <bperutil/BPerUniStd.h>
#include <bperutil/BPerErrorCode.h>
#include <bperutil/BPerMemory.h>


#define BPer_Server_Srs 0
#define BPer_Server_Zlm 1
#define BPer_Server_P2p 7
#define BPer_Server_Whip_Whep 9

#define BPer_Rtmp 0
#define BPer_Srt 1
#define BPer_Webrtc 2

#define BPerBool int32_t
#define BPerTrue 1
#define BPerFalse 0

#define bPer_delete(a) {if( (a)) {delete (a); (a) = NULL;}}
#define bPer_deleteA(a) {if( (a)) {delete[] (a); (a) = NULL;}}
#define bPer_free(a) {if( (a)) {free((a)); (a) = NULL;}}
#define bPer_min(a, b) (((a) < (b))? (a) : (b))
#define bPer_max(a, b) (((a) < (b))? (b) : (a))


#define BPER_UTIME_MILLISECONDS 1000
#define BPER_UTIME_SECONDS 		1000000
#if BPer_Enable_Embbed
#define BPER_VIDEO_ENCODE_BUFFER_LEN 1024 * 512
#define BPER_RTC_RECV_BUFFER_COUNT 512
#define BPER_RTC_RECV_BUFFER_COUNT2 511
#else
#define BPER_VIDEO_ENCODE_BUFFER_LEN 1024 * 1024
#define BPER_RTC_RECV_BUFFER_COUNT 1024
#define BPER_RTC_RECV_BUFFER_COUNT2 1023
#endif
#define BPER_GET_RECV_BUFFER_INDEX(x) 	 x&BPER_RTC_RECV_BUFFER_COUNT2

#define BPer_AV1_Name "AV1X"

#define BPERALIGN(x, a) (((x)+(a)-1)&~((a)-1))
#define BPER_INADDR_ANY 0x00000000
typedef enum{
	BPer_Socket_Protocol_Udp,
	BPer_Socket_Protocol_Tcp
}BPerSocketProtocol;

typedef enum {
	BPer_IpFamilyType_IPV4,
	BPer_IpFamilyType_IPV6
} BPerIpFamilyType;




#endif /* INCLUDE_BPERUTIL_BPERTYPE_H_ */
